package Demo08.Demo0825;

public class Date {
    //类的成员变量
    public int year;
    public int month;
    public int day;

    //类的成员方法
    public void setDay(int y,int m,int d){
        year = y;
        month = m;
        day = d;
    }

    //构造器---形式参数
    public Date(int year,int month,int day){
        this.year = year;
        this.month = month;
        this.day = day;
        System.out.println("Date(int,int,int)方法被调用了");
    }

    //构造器--直接一点
    public Date(){
        year = 1900;
        month = 1;
        day = 1;
    }

    public void printDate(){
        System.out.println(year + "/" + month + "/" + day);
    }

    public static void main(String[] args){
        /*//构造三个日期类型的对象 d1 d2 d3
        Date d1 = new Date();
        Date d2 = new Date();
        Date d3 = new Date();

        //对d1 d2 d3的值进行设定
        d1.setDay(2021,9,15);
        d2.setDay(2021,9,16);
        d3.setDay(2021,9,17);

        d1.printDate();
        d2.printDate();
        d3.printDate();*/
        /*  Date d = new Date();
        d.setDay(2020,9,15);
        d.printDate();*/
       /* Date d = new Date(2021,6,9);
        d.printDate();*/

        Date d = new Date();
        d.printDate();
    }

}
